package com.example.lishop.repository

import com.example.lishop.entity.BBusinessEntity
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Modifying
import org.springframework.data.jpa.repository.Query
import org.springframework.transaction.annotation.Transactional
import java.util.*

/**
 * Created on 2021/3/14 18:00
 * @author shuguo
 */
interface BusinessRepository : JpaRepository<BBusinessEntity, Int>{

    fun findByDepId(depId: String): BBusinessEntity?

    @Transactional(timeout = 10)
    @Modifying
    @Query("update BBusinessEntity set sts = '1' where depId = ?1")
    fun del(depId: String)

    @Transactional(timeout = 10)
    @Modifying
    @Query("update BBusinessEntity set name = :name, descript = :descript, type = :type, tag = :tag, status = :status, sts = :sts where depId = :depId")
    fun update(depId:String, name:String, descript:String, type:String, tag:String, status:String, sts:String)
}